<template>
    <!-- 变更查看页面 -->
    <div class="e-form">
        <div class="tabs">
            <el-tabs
                tab-position="left"
                v-model="tabsName"
                @tab-click="onChangeTab"
            >
                <!-- 基本信息 -->
                <el-tab-pane
                    label="基本信息"
                    name="baseInfo"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane
                    label="资质信息"
                    name="aptitude"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane
                    label="企业主要业绩"
                    name="firmPerformance"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane
                    label="企业主要管理人"
                    name="firmAdmin"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane
                    label="附件信息"
                    name="accessory"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane
                    label="审核历史"
                    name="auditHistory"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <div>
                    <!-- 基本信息 -->
                    <div id="baseInfoCon" class="con">
                        <div class="e-form">
                            <div class="tabs">
                                <div class="tabs-title" id="baseInfo">
                                    基本信息
                                </div>
                                <div style="width: 100%" class="form">
                                    <el-form
                                        :model="basicFormData"
                                        label-width="150px"
                                    >
                                        <BillTop
                                            title="分包商变更详情"
                                            @cancel="handleClose"
                                        ></BillTop>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="统一社会信用代码"
                                                >
                                                    {{
                                                        basicFormData.creditCode
                                                    }}
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="分包商名称"
                                                >
                                                    {{
                                                        basicFormData.subcontractorName
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.subcontractorName !=
                                                                basicFormData.subcontractorName
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="类型">
                                                    {{
                                                        basicFormData.subcontractorTypeKey
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.subcontractorTypeKey !=
                                                                basicFormData.subcontractorTypeKey
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item label="法人代表">
                                                    {{ basicFormData.deputy }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.deputy !=
                                                                basicFormData.deputy
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-form-item label="注册地址">
                                                <!-- 省地址 -->
                                                {{
                                                    showAddress(
                                                        basicFormData.addressDetail
                                                    )
                                                }}
                                                <img
                                                    v-if="
                                                        isLoad &&
                                                        oldEditData.addressDetail !=
                                                            basicFormData.addressDetail
                                                    "
                                                    class="img-style"
                                                    src="@/assets/biangeng.png"
                                                    alt=""
                                                />
                                            </el-form-item>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="联系电话">
                                                    {{
                                                        basicFormData.contactTel
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.contactTel !=
                                                                basicFormData.contactTel
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="注册资本（万元）"
                                                >
                                                    {{
                                                        basicFormData.registerCapital
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.registerCapital !=
                                                                basicFormData.registerCapital
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="传真">
                                                    {{ basicFormData.fax }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.fax !=
                                                                basicFormData.fax
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item label="邮箱">
                                                    {{ basicFormData.email }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.email !=
                                                                basicFormData.email
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="纳税类别">
                                                    {{ basicFormData.taxType }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.taxTypeKey !=
                                                                basicFormData.taxTypeKey
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item label="邮编">
                                                    {{ basicFormData.postCode }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.postCode !=
                                                                basicFormData.postCode
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="增值税一般纳税人资格查询"
                                                    ><a
                                                        href="https://etax.sichuan.chinatax.gov.cn/"
                                                        target="_blank"
                                                        >查询</a
                                                    >
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="四川住房城乡建设厅信息查询"
                                                >
                                                    <a
                                                        href="http://202.61.88.188/xxgx/index.aspx"
                                                        target="_blank"
                                                        >查询</a
                                                    ></el-form-item
                                                >
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="信用信息查询"
                                                >
                                                    <a
                                                        href="http://www.gsxt.gov.cn/index.html"
                                                        target="_blank"
                                                        >查询</a
                                                    >
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item label="管理单位">
                                                    {{
                                                        basicFormData.manageOrgName
                                                    }}
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="是否为境外单位"
                                                >
                                                    <span
                                                        v-if="
                                                            basicFormData.isAbroadUnit ==
                                                            1
                                                        "
                                                    >
                                                        {{ '是' }}
                                                    </span>
                                                    <span
                                                        v-if="
                                                            basicFormData.isAbroadUnit ==
                                                            0
                                                        "
                                                    >
                                                        {{ '否' }}
                                                    </span>
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.isAbroadUnit !=
                                                                basicFormData.isAbroadUnit
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item label="录入人">
                                                    {{
                                                        basicFormData.enteringPerson
                                                    }}
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="信用等级">
                                                    <span>
                                                        {{
                                                            basicFormData.creditLevelName ==
                                                            '0'
                                                                ? '待定'
                                                                : basicFormData.creditLevelName ==
                                                                  '1'
                                                                ? 'A'
                                                                : basicFormData.creditLevelName ==
                                                                  '2'
                                                                ? 'B'
                                                                : basicFormData.creditLevelName ==
                                                                  '3'
                                                                ? 'C'
                                                                : basicFormData.creditLevelName ==
                                                                  '4'
                                                                ? 'D'
                                                                : basicFormData.creditLevelName ==
                                                                  '5'
                                                                ? 'S'
                                                                : ''
                                                        }}</span
                                                    >
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12">
                                                <el-form-item label="状态：">
                                                    {{
                                                        statusLable(
                                                            basicFormData.state
                                                        )
                                                    }}
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row v-if="isShow">
                                            <el-form-item label="固定工作地址">
                                                <span>
                                                    {{
                                                        showAddress(
                                                            basicFormData.fixAddressDetail
                                                        )
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.fixAddressDetail !=
                                                                basicFormData.fixAddressDetail
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </span>
                                            </el-form-item>
                                        </el-row>
                                        <el-row v-if="isShow">
                                            <el-col :span="24">
                                                <el-form-item
                                                    label="企业基本情况"
                                                >
                                                    {{
                                                        basicFormData.basicInfo
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.basicInfo !=
                                                                basicFormData.basicInfo
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row v-if="isShow">
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="企业注册建造师数量"
                                                >
                                                    {{
                                                        basicFormData.registeredConstructorQty
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.registeredConstructorQty !=
                                                                basicFormData.registeredConstructorQty
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>

                                            <el-col :span="12">
                                                <el-form-item
                                                    label="中级及以上职称人员数量"
                                                >
                                                    {{
                                                        basicFormData.aboveTitleQty
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.aboveTitleQty !=
                                                                basicFormData.aboveTitleQty
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row v-if="isShow">
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="持有岗位证书的施工现场管理人员数量"
                                                >
                                                    {{
                                                        basicFormData.certificateQty
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.certificateQty !=
                                                                basicFormData.certificateQty
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>

                                            <el-col :span="12">
                                                <el-form-item
                                                    label="持有安全C证人员数量"
                                                >
                                                    {{
                                                        basicFormData.safetyCertificateQty
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.subcontractorName !=
                                                                basicFormData.subcontractorName
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row v-if="isShow">
                                            <el-col :span="12">
                                                <el-form-item
                                                    label="正常缴纳社保人数"
                                                >
                                                    {{
                                                        basicFormData.paySocialSecurityQty
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.safetyCertificateQty !=
                                                                basicFormData.safetyCertificateQty
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>

                                            <el-col :span="12">
                                                <el-form-item
                                                    label="经考级或培训合格的中级工以上技术工人数量"
                                                >
                                                    {{
                                                        basicFormData.passedTrainingQty
                                                    }}
                                                    <img
                                                        v-if="
                                                            isLoad &&
                                                            oldEditData.passedTrainingQty !=
                                                                basicFormData.passedTrainingQty
                                                        "
                                                        class="img-style"
                                                        src="@/assets/biangeng.png"
                                                        alt=""
                                                    />
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                    </el-form>
                                </div>
                            </div>
                        </div>

                        <!-- ------------------------------------------------------------------------------------- -->
                    </div>

                    <!-- 资质信息 -->
                    <div id="aptitudeCon" class="con">
                        <div class="tabs-title" id="aptitude">资质信息</div>
                        <div class="e-table">
                            <div class="top">
                                <div class="left">
                                    <div>
                                        <el-button
                                            size="small"
                                            style="
                                                background: #7aa818;
                                                color: #fff;
                                            "
                                            >下载</el-button
                                        >
                                    </div>
                                </div>
                            </div>
                            <el-table
                                :data="aptitudeTable"
                                border
                                style="width: 100%"
                                ref="table"
                                class="table"
                                @cell-mouse-enter="cellMouseEnter"
                                :max-height="$store.state.tableHeight"
                                @cell-mouse-leave="cellMouseLeave"
                                :cell-class-name="cellClsNm"
                                :row-class-name="tableRowClass"
                                :header-cell-style="{ textAlign: 'center' }"
                                :cell-style="{ textAlign: 'center' }"
                                v-sortTable="{
                                    tableData: aptitudeTable,
                                    _this: this,
                                    ref: 'table'
                                }"
                            >
                                <el-table-column label="操作" width="55">
                                    <template slot-scope="{ row }">
                                        <img
                                            src="@/assets/btn/downLoad.png"
                                            @click="handleDownload(row, 1)"
                                            style="margin-right: 5px"
                                        />
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    label="序号"
                                    type="index"
                                    width="60"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="certNo"
                                    label="证书编号"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="certTypeValue"
                                    label="证书类型"
                                    width="100"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="qualificationLevelId"
                                    label="主营范围/证书等级"
                                    width="200"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="startDate"
                                    label="有效期开始日期"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="endDate"
                                    label="有效期结束日期"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="fileName"
                                    label="文件名"
                                    min-width="120"
                                >
                                    <template slot-scope="scope">
                                        <span
                                            @click="preview(scope.row)"
                                            style="color: blue; cursor: pointer"
                                        >
                                            {{ scope.row.fileName }}
                                        </span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    prop="size"
                                    label="大小"
                                    width="100"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="gmtCreate"
                                    label="上传时间"
                                    width="100"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="founderName"
                                    label="上传人"
                                    width="100"
                                >
                                </el-table-column>
                            </el-table>
                        </div>
                    </div>

                    <!-- 企业主要业绩 -->
                    <div id="firmPerformanceCon" class="con">
                        <div class="tabs-title" id="firmPerformance">
                            企业主要业绩
                        </div>
                        <div class="e-table">
                            <div class="top">
                                <div class="left">
                                    <div>
                                        <el-button
                                            size="small"
                                            style="
                                                background: #7aa818;
                                                color: #fff;
                                            "
                                            >下载</el-button
                                        >
                                    </div>
                                </div>
                            </div>
                            <el-table
                                :data="performanceData"
                                border
                                style="width: 100%"
                                ref="table"
                                class="table"
                                @cell-mouse-enter="cellMouseEnter"
                                :max-height="$store.state.tableHeight"
                                @cell-mouse-leave="cellMouseLeave"
                                :cell-class-name="cellClsNm"
                                :row-class-name="tableRowClass"
                                :header-cell-style="{ textAlign: 'center' }"
                                :cell-style="{ textAlign: 'center' }"
                                v-sortTable="{
                                    tableData: performanceData,
                                    _this: this,
                                    ref: 'table'
                                }"
                            >
                                <el-table-column label="操作" width="55">
                                    <template slot-scope="{ row }">
                                        <img
                                            src="@/assets/btn/downLoad.png"
                                            @click="handleDownload(row, 2)"
                                            style="margin-right: 5px"
                                        />
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    label="序号"
                                    type="index"
                                    width="60"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="contractName"
                                    label="合同名称"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="projectName"
                                    label="项目名称"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="contractAmount"
                                    label="合同金额"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="workContect"
                                    label="所承担工程内容"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="startDate"
                                    label="开工时间"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="endDate"
                                    label="竣工时间"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="projectLeader"
                                    label="项目负责人"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="witnessName"
                                    label="业绩证明人"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="witnessTel"
                                    label="证明人电话"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="opinion"
                                    label="质量安全信誉评价意见"
                                    width="200"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="fileName"
                                    label="附件"
                                    width="150"
                                >
                                    <template slot-scope="scope">
                                        <span
                                            @click="preview1(scope.row)"
                                            style="color: blue; cursor: pointer"
                                        >
                                            {{ scope.row.fileName }}
                                        </span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    prop="contractTypeDesc"
                                    label="合同类型"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="contractStateDesc"
                                    label="合同状态"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="source"
                                    label="业绩来源"
                                    width="150"
                                >
                                    <template slot-scope="scope">
                                        {{
                                            scope.row.source == 0
                                                ? '系统内'
                                                : scope.row.source == 0
                                                ? '系统外'
                                                : ''
                                        }}
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                    </div>
                    <!-- 企业主要管理人 -->
                    <div id="firmAdminCon" class="con">
                        <div class="tabs-title" id="firmAdmin">
                            企业主要管理人
                        </div>
                        <div class="e-table">
                            <div class="top">
                                <div class="left">
                                    <div>
                                        <el-button
                                            size="small"
                                            style="
                                                background: #7aa818;
                                                color: #fff;
                                            "
                                            >下载</el-button
                                        >
                                    </div>
                                </div>
                            </div>
                            <el-table
                                :data="staffData"
                                border
                                style="width: 100%"
                                ref="table"
                                class="table"
                                :max-height="$store.state.tableHeight"
                                @cell-mouse-enter="cellMouseEnter"
                                @cell-mouse-leave="cellMouseLeave"
                                :cell-class-name="cellClsNm"
                                :row-class-name="tableRowClass"
                                :header-cell-style="{ textAlign: 'center' }"
                                :cell-style="{ textAlign: 'center' }"
                                v-sortTable="{
                                    tableData: staffData,
                                    _this: this,
                                    ref: 'table'
                                }"
                            >
                                <el-table-column label="操作" width="55">
                                    <template slot-scope="{ row }">
                                        <img
                                            src="@/assets/btn/downLoad.png"
                                            @click="handleDownload(row, 3)"
                                            style="margin-right: 5px"
                                        />
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    label="序号"
                                    type="index"
                                    width="60"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="personTypeKey"
                                    label="人员类别"
                                    width="160"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="staffName"
                                    label="姓名"
                                    width="100"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="idCard"
                                    label="身份证号码"
                                    width="200"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="tel"
                                    label="联系电话"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="certNo"
                                    label="证书及编号"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="beginDate"
                                    label="身份证有效开始日期"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="endDate"
                                    label="身份证有效结束日期"
                                    width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="fileName"
                                    label="身份证附件"
                                    width="100"
                                >
                                    <template slot-scope="scope">
                                        <span
                                            @click="preview2(scope.row)"
                                            style="color: blue; cursor: pointer"
                                        >
                                            {{ scope.row.fileName }}
                                        </span>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                    </div>
                    <!-- 附件信息 -->
                    <div id="accessoryCon" class="con">
                        <div class="tabs-title" id="accessory">附件信息</div>
                        <div class="e-table">
                            <div class="top">
                                <div>
                                    <el-button
                                        size="small"
                                        style="background: #7aa818; color: #fff"
                                        >下载</el-button
                                    >
                                </div>
                            </div>
                            <el-table
                                :data="enclosureTable"
                                border
                                style="width: 100%"
                                ref="table"
                                class="table"
                                :max-height="$store.state.tableHeight"
                                @cell-mouse-enter="cellMouseEnter"
                                @cell-mouse-leave="cellMouseLeave"
                                :cell-class-name="cellClsNm"
                                :row-class-name="tableRowClass"
                                :header-cell-style="{ textAlign: 'center' }"
                                :cell-style="{ textAlign: 'center' }"
                                v-sortTable="{
                                    tableData: enclosureTable,
                                    _this: this,
                                    ref: 'table'
                                }"
                            >
                                <el-table-column label="操作" width="55">
                                    <template slot-scope="{ row }">
                                        <img
                                            src="@/assets/btn/downLoad.png"
                                            @click="handleDownload(row, 4)"
                                            style="margin-right: 5px"
                                        />
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    label="序号"
                                    type="index"
                                    width="60"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="fileTypeKey"
                                    label="类型"
                                    min-width="150"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="fileName"
                                    label="文件名称"
                                    width="200"
                                >
                                    <template slot-scope="scope">
                                        <span
                                            @click="preview3(scope.row)"
                                            style="color: blue; cursor: pointer"
                                        >
                                            {{ scope.row.fileName }}
                                        </span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    prop="fileSize"
                                    label="文件大小"
                                    width="100"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="gmtCreate"
                                    label="上传时间"
                                    width="200"
                                >
                                </el-table-column>
                                <el-table-column
                                    prop="fileUploaderName"
                                    label="上传人"
                                    width="100"
                                >
                                </el-table-column>
                            </el-table>
                        </div>
                    </div>
                    <!-- 审核历史 -->
                    <div id="auditHistoryCon" class="con">
                        <div class="tabs-title" id="auditHistory">审核历史</div>
                        <ComExaHistory
                            :billType="parseInt(billid)"
                            @getAuditHistory="getAuditHistory"
                            :tableData="tableData"
                            ref="ComExaHistory"
                        />
                    </div>
                </div>
            </el-tabs>
        </div>
        <div id="seat" :style="{ height: seatHeight + 'px' }"></div>
        <div class="buttons">
            <ComExaButtons
                v-if="basicFormData.state != -1 && basicFormData.state != 5"
                :auditState="auditState"
                :state="basicFormData.state"
                :founderId="founderId"
                @exas="exas"
            />
            <el-button size="small" @click="handleClose">取消</el-button>
        </div>
    </div>
</template>

<script>
import { toVoid } from '@/api/OutsourcingartyAdmin/subcontractorAdmin/subcontractor.js'
import subcontractorChange from '@/api/OutsourcingartyAdmin/subcontractorAdmin/subcontractorChange.js'
import ComExaButtons from '@/components/common/exaButtons'
import examine from '@/api/OutsourcingartyAdmin/subcontractorAdmin/examine.js'
import { mapMutations } from 'vuex'
//审核历史
import ComExaHistory from '@/components/common/exaHistory.vue'
import {
    showSuccessPop,
    openAppClient,
    throttle,
    showLoading,
    hideLoading
} from '@/utils/common'
import service from '@/utils/request'
export default {
    components: {
        ComExaButtons,
        ComExaHistory
    },
    data () {
        return {
            tabsName: 'baseInfo',
            founderId: '', //登录人id
            userName: '', //登录人name
            form: {
                name: '',
                region: '',
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                desc: ''
            },
            tableData: [],
            value: '',
            textarea: '',
            screenWidth: 0,
            screenHeight: 0,
            lastConHeight: 0,
            clickTabFlag: false, // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            //基本信息表单数据
            basicFormData: {
                creditCode: '', //统一社会信用代码
                subcontractorName: '', //分包商名称
                type: '', //类型
                deputy: '', //法人代表
                registerAddProvince: '', //注册地址省
                registerAddCity: '', //注册地址市
                registerAddDistrict: '', //注册地址先去
                registerAddInfo: '', //注册地址详细
                contactTel: '', //联系电话
                registerCapital: '', //注册资本
                fax: '', //传真
                email: '', //邮箱
                taxType: '', //纳税类别
                postCode: '', //邮编
                manageOrgName: '', //管理单位
                isAbroadUnit: '', //是否为境外单位
                enteringPerson: '', //录入人  ????
                creditLevelName: '2', //信用等级
                state: 0, //状态
                fixedAddProvince: '', //固定地址省
                fixedAddCity: '', //固定地址市
                fixedAddDistrict: '', //固定地址县区
                fixedAddInfo: '', //固定地址详细
                basicInfo: '', //企业基本情况
                registeredConstructorQty: '', //企业注册建造师数量
                aboveTitleQty: '', //中级及以上职称人员数量
                certificateQty: '', //持有岗位证书的施工现场管理人员数量
                safetyCertificateQty: '', //持有安全C证人员数量
                paySocialSecurityQty: '', //正常缴纳社保人数
                passedTrainingQty: '' //经考级或培训合格的中级工以上技术工人数量
            },
            aptitudeTable: [], //资质信息
            performanceData: [], //主要业绩
            staffData: [], //主要管理人
            enclosureTable: [], //附件
            auditState: {}, //按钮状态
            winEvent: {}, //保存事件，跳转页面的时候，结束事件，优化性能
            isShow: true, //是否显示企业详情
            oldEditData: {}, //原单
            isLoad: false, //判断接口值回来没有
            nullifyParams: {
                //作废
                billId: this.$route.query.billid,
                billType: '60401',
                nullifyCreated: '',
                nullifyCreator: '',
                nullifyCreatorId: '',
                nullifyDescription: '',
                nullifyReason: ''
            }
        }
    },
    computed: {
        // 填补底部空白，以使高度够滚动
        seatHeight () {
            return this.screenHeight - 255 - this.lastConHeight
        },
        // 判断状态
        statusLable () {
            return param => {
                const state = this.$store.state.equip.equipData.state
                const obj = state.find(x => x.value == param)
                if (obj !== undefined) {
                    return obj.label
                }
            }
        },
        showAddress () {
            return value => {
                if (!value) return ''
                try {
                    let obj = JSON.parse(value)
                    const address = obj.address ? obj.address.join('-') : ''
                    const detail = obj.detail
                    let str = ''
                    if (address && detail) {
                        str = address + '-' + detail
                    } else if (!address && detail) {
                        str = detail
                    } else if (address && !detail) {
                        str = address
                    }
                    return str
                } catch (err) {
                    return value
                }
            }
        }
    },
    created () {
        this.billid = this.$route.query.billid
        this.userName = localStorage.getItem('userName')
        this.founderId = localStorage.getItem('userId')
        this.getBasicData() //进入页面就获取基本信息数据
        this.qualificationList(this.billid) //初始化资质信息列表
        this.performanceList(this.billid) //初始化企业主要业绩
        this.staffList(this.billid) //主营业绩
        this.getObjectByRelationId() //附件
        this.getCurrentUnitInfo() //流程按钮
    },
    mounted () {
        // 获取最后一个内容区域的高度，计算底部空白
        this.getLastConHeight()

        // 保存所有tabName
        const arr = [
            'baseInfo',
            'aptitude',
            'firmPerformance',
            'firmAdmin',
            'accessory',
            'auditHistory'
        ]
        let $idsTop = []
        const onScroll = () => {
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            if (this.clickTabFlag) {
                return
            }
            if (!$idsTop[$idsTop.length - 1]) {
                $idsTop = arr.map(item => {
                    const $item = document.getElementById(item)
                    let itemTop = null
                    if ($item) {
                        itemTop = $item.offsetTop
                    }
                    return itemTop
                })
            }
            const scrollTop =
                document.documentElement.scrollTop || document.body.scrollTop
            // 倒序查找
            let curLocal = 0
            for (let len = $idsTop.length, i = len - 1; i >= 0; i--) {
                let item = $idsTop[i]
                if (scrollTop + 1 >= item) {
                    curLocal = i
                    break
                }
            }
            // 设置对应tabName
            this.tabsName = arr[curLocal]
        }
        this.winEvent.onScroll = onScroll
        window.addEventListener('scroll', this.winEvent.onScroll)
        this.screenWidth =
            document.documentElement.clientWidth - this.topHeight
        this.screenHeight =
            document.documentElement.clientHeight - this.topHeight
        const onResize = () => {
            this.screenWidth = document.documentElement.clientWidth
            this.screenHeight = document.documentElement.clientHeight
            $idsTop = arr.map(item => {
                const itemTop = document.getElementById(item).offsetTop
                return itemTop
            })
        }
        this.winEvent.onResize = throttle(onResize, 500)
        window.addEventListener('resize', this.winEvent.onResize)
    },
    beforeDestroy () {
        window.removeEventListener('scroll', this.winEvent.onScroll)
        window.removeEventListener('resize', this.winEvent.onResize)
    },
    methods: {
        ...mapMutations(['setSelectedInfo', 'setAuditParams']),
        //修改行样式
        tableRowClass ({ row }) {
            if (row.state == -1) {
                return 'red'
            } else if (row.state == 1) {
                return 'green'
            } else if (row.state == 2) {
                return 'yellow'
            }
            return ''
        },
        // 获取按钮状态
        getCurrentUnitInfo () {
            examine
                .getCurrentUnitInfo({
                    billId: this.billid,
                    billType: 60401,
                    freeNextUnitIndex: 0,
                    freeNextUser: '',
                    isPass: true,
                    isShareInAudit: true,
                    opinion: ''
                })
                .then(res => {
                    this.auditState = res
                })
        },
        //获取基本信息数据
        async getBasicData () {
            let newData = await subcontractorChange.findByIdBasic(this.billid)
            this.isLoad = true
            this.basicFormData = newData
            this.basicFormData.taxType = newData.taxTypeKey
            this.basicFormData.enteringPerson = this.userName
            this.basicFormData.creditLevelName = newData.creditLevel
            // 处理是否展示企业详情
            this.isAbroadUnitChange(newData.isAbroadUnit)
            this.handleCheckedCitiesChange(newData.subcontractorTypeKey)
            this.basicFormData.subcontractorTypeKey =
                newData.subcontractorTypeKey.join(',')
            //处理注册地址
            let data = JSON.parse(newData.addressDetail).address.join('')
            let data1 = JSON.parse(newData.addressDetail).detail
            this.basicFormData.addressDetail = data + data1
            //处理固定地址
            let data2 = JSON.parse(newData.fixAddressDetail).address.join('')
            let data3 = JSON.parse(newData.fixAddressDetail).detail
            // 基础数据请求成功调用变字接口请求数据
            this.basicFormData.fixAddressDetail = data2 + data3
            this.getyuandan(newData.sourceId)
        },
        // 获取原单数据，控制变字显示与否
        getyuandan (val) {
            this.$Ajax
                .httpGet({
                    url: '/outer/subcontractor/findById',
                    params: {
                        id: val
                    },
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                .then(res => {
                    // 深拷贝将编辑的基础数据赋值给对象，保证基础数据不变
                    this.oldEditData = JSON.parse(JSON.stringify(res))
                    //处理注册地址
                    let data = JSON.parse(res.addressDetail).address.join('')
                    let data1 = JSON.parse(res.addressDetail).detail
                    this.oldEditData.addressDetail = data + data1
                    //处理固定地址
                    let data2 = JSON.parse(res.fixAddressDetail).address.join(
                        ''
                    )
                    let data3 = JSON.parse(res.fixAddressDetail).detail
                    this.oldEditData.fixAddressDetail = data2 + data3
                })
        },
        // 获取最后一个内容区域的高度，计算底部空白
        getLastConHeight () {
            let si = setInterval(() => {
                // 因为dom异步加载，通过轮询找到渲染后的dom，获取高度
                if (document.getElementById('auditHistoryCon')) {
                    const lastConHeight =
                        document.getElementById('auditHistoryCon').offsetHeight
                    this.lastConHeight = lastConHeight
                    clearInterval(si)
                    si = null
                }
            }, 100)
        },
        //删除
        delData () {
            this.$Ajax
                .httpGet({
                    url: '/outer/subcontractor/delete',
                    params: {
                        id: this.id
                    },
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                .then(res => {
                    this.$message({
                        showClose: true,
                        type: 'success',
                        message: res.message
                    })
                    this.$router.push('./subcontractorWarehouse')
                })
        },
        submit () {},
        handleFullScreen () {
            this.fullscreen = !this.fullscreen
        },
        //取消
        handleClose () {
            this.$router.replace('/subcontractorWarehouse')
        },
        cellClsNm ({ column }) {
            if (column.label === '') {
                return 'fixed-left'
            }
        },
        cellMouseEnter (row) {
            this.MouseEnterId = row.id
        },
        cellMouseLeave () {
            this.MouseEnterId = 0
        },
        onChangeTab (e) {
            const height = $('#' + e.name).offset().top
            $.scrollTo(height - this.topHeight, 500)
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            this.clickTabFlag = true
            // 动画结束后，恢复状态
            setTimeout(() => {
                this.clickTabFlag = false
            }, 600)
        },
        // 资质信息列表
        async qualificationList (val) {
            let data = await subcontractorChange.findByIdqualification(val)
            data.map(item => {
                if (new Date(item.endDate).getFullYear() == 9999) {
                    item.endDate = '永久'
                }
            })
            this.aptitudeTable = data
        },
        // 主要业绩
        async performanceList (val) {
            let data = await subcontractorChange.changeAchievementList({
                billId: val,
                keyword: ''
            })
            if (data.length > 0) {
                this.performanceData = data
            }
        },
        // 主要管理人
        async staffList (val) {
            let data = await subcontractorChange.findByIdstaff(val)
            if (data.length > 0) {
                this.staffData = data
            }
        },
        // 附件
        async getObjectByRelationId () {
            let data = await subcontractorChange.getEnclosureChangeList(
                this.billid
            )
            if (data.length > 0) {
                this.enclosureTable = data
            }
        },
        // 是否为境外单位，判断是否显示企业详情
        isAbroadUnitChange (row) {
            let flag = false
            if (
                this.basicFormData.subcontractorTypeKey.includes('其他') &&
                this.basicFormData.subcontractorTypeKey.length == 1
            ) {
                flag = true
            } else {
                flag = false
            }
            if (row == 1 || flag) {
                this.isShow = false
            } else {
                this.isShow = true
            }
        },
        handleCheckedCitiesChange (value) {
            let checkedCount = value.length
            // 通过类型判断是否是小规模纳税人
            if (value.includes('其他') && checkedCount == 1) {
                this.isShow = false
            } else {
                if (this.basicFormData.isAbroadUnit == 1) {
                    this.isShow = false
                } else {
                    this.isShow = true
                }
            }
        },
        //预览附件
        preview (val) {
            this.aptitudeTable.some(item => {
                if (item.id == val.id) {
                    window.open(item.dialogImage)
                }
            })
        },
        //企业主要业绩预览附件
        preview1 (val) {
            this.performanceData.some(item => {
                if (item.id == val.id) {
                    window.open(item.dialogImage)
                }
            })
        },
        //企业主要管理人预览附件
        preview2 (val) {
            this.staffData.some(item => {
                if (item.id == val.id) {
                    window.open(item.dialogImage)
                }
            })
        },
        //附件预览附件
        preview3 (val) {
            this.enclosureTable.some(item => {
                if (item.id == val.id) {
                    window.open(item.dialogImage)
                }
            })
        },
        audit () {
            // 客户端弹窗弹出本地页面
            openAppClient('/exaDialog', '填写审核意见', () => {
                // 审核拿到审核弹窗的意见
                const auditParams = JSON.parse(localStorage.vuex).auditParams
                // 将审核意见赋值给参数传给后端
                examine
                    .audit({
                        billId: this.$route.query.billid,
                        billType: 60401,
                        freeNextUnitIndex: 0,
                        freeNextUser: '',
                        isPass: auditParams.isPass,
                        isShareInAudit: true,
                        opinion: auditParams.opinion
                    })
                    .then(() => {
                        this.clientPop('suc', '审核成功')
                        // 保存成功置空数据
                        this.firmAdminTable = []
                        this.firmPerformanceTable = []
                        this.aptitudeTable = []
                        this.attachTable = []
                        // 返回列表
                        this.handleClose()
                    })
            }, null, null, null, 'small')
        },
        // 作废
        toVoidChange () {
            this.clientPop('info', '是否确认作废', this.callback)
        },
        // 作废确认回调
        async callback () {
            this.setAuditParams(this.nullifyParams)
            openAppClient('/nullifyDialog', '单据作废原因', () => {
                const auditParams = JSON.parse(localStorage.vuex).auditParams
                toVoid(auditParams).then(() => {
                    this.clientPop(
                        'suc',
                        '作废成功',
                        this.handleClose,
                        null,
                        this.handleClose
                    )
                })
            })
        },
        // 撤回
        withdrawChange () {
            this.clientPop('info', '是否确认撤回', this.callbackWithdraw)
        },
        // 撤回确认回调
        async callbackWithdraw () {
            let { code } = await examine.undoAudit({
                billId: this.billid, //单据id
                billType: '60401', //单据类型
                freeNextUnitIndex: 0,
                freeNextUser: '',
                isPass: true,
                isShareInAudit: true,
                opinion: ''
            })
            if (code == 200) {
                showSuccessPop('撤回成功')
                this.handleClose()
            } else {
                showSuccessPop('撤回失败')
            }
        },
        // 审核历史列表查询
        async getAuditHistory () {
            let data = await subcontractorChange.findByIdAuditHistory({
                billId: this.billid,
                billType: 60401,
                freeNextUnitIndex: 0,
                freeNextUser: '',
                isPass: true,
                isShareInAudit: true,
                opinion: ''
            })
            this.tableData = data
        },
        //下载某一行
        async handleDownload (obj, number) {
            let url = ''
            let fileNameFull = ''
            if (number === 4) {
                url = obj.objectPath
                fileNameFull = obj.objectName
            } else {
                url = obj.dialogImage
                fileNameFull = obj.fileName
            }
            showLoading()
            const fileExt = fileNameFull.split('.').pop()
            if (
                ['jpg', 'jpeg', 'gif', 'png', 'bmp'].indexOf(
                    fileExt.toLowerCase()
                ) === -1
            ) {
                const { httpGetFile } = service
                const data = await httpGetFile({ url })
                const blob = new Blob([data])
                const reader = new FileReader()
                reader.readAsDataURL(blob)
                reader.onload = function (e) {
                    this.autoClick({
                        fileName: fileNameFull,
                        url: e.target.result
                    })
                }.bind(this)
            } else {
                this.downloadIamge(url, fileNameFull)
            }
            hideLoading()
        },
        downloadIamge (imgsrc, fileName) {
            //下载图片地址和图片名
            var image = new Image()
            // 解决跨域 Canvas 污染问题
            image.setAttribute('crossOrigin', 'anonymous')
            image.onload = function () {
                const canvas = document.createElement('canvas')
                canvas.width = image.width
                canvas.height = image.height
                const context = canvas.getContext('2d')
                context.drawImage(image, 0, 0, image.width, image.height)
                const _dataURL = canvas.toDataURL('image/png') //得到图片的base64编码数据

                const blob_ = this.dataURLtoBlob(_dataURL) // 用到Blob是因为图片文件过大时，在一部风浏览器上会下载失败，而Blob就不会

                const url = {
                    name: fileName || '图片.png', // 图片名称不需要加.png后缀名
                    src: blob_
                }

                if (window.navigator.msSaveOrOpenBlob) {
                    navigator.msSaveBlob(url.src, url.name) //filename文件名包括扩展名，下载路径为浏览器默认路径
                } else {
                    this.autoClick({
                        fileName: url.name,
                        url: window.URL.createObjectURL(url.src)
                    })
                }
            }.bind(this)
            image.src = imgsrc
        },
        dataURLtoBlob (dataurl) {
            var arr = dataurl.split(','),
                mime = arr[0].match(/:(.*?);/)[1],
                bstr = window.atob(arr[1]),
                n = bstr.length,
                u8arr = new Uint8Array(n)
            while (n--) {
                u8arr[n] = bstr.charCodeAt(n)
            }
            return new Blob([u8arr], { type: mime })
        },
        autoClick ({ fileName, url }) {
            const elink = document.createElement('a')
            elink.download = fileName
            elink.style.display = 'none'
            elink.href = url
            document.body.appendChild(elink)
            elink.click()
            document.body.removeChild(elink)
        },
        // 按钮组件触发事件
        exas (data) {
            switch (data) {
            case 'audit':
                this.audit() //审核
                break
            case 'undoAudit':
                this.withdrawChange() //撤回
                break
            case 'submitCommit':
                this.submit() //提交
                break
            case 'submit':
                this.save() //保存
                break
            case 'nullify':
                this.toVoidChange() //作废
                break
            case 'deleteData':
                this.ctDelete() //删除
                break
            default:
                break
            }
        }
    }
}
</script>

<style lang="scss" scoped>
.buttons {
    left: 0;
}
.e-form {
    margin-bottom: 80px;
    padding: 0 20px;
    .tabs-title::before {
        content: '';
        height: 22px;
        width: 8px;
        border-radius: 40px;
        background-color: #2e61d7;
        display: block;
        position: absolute;
        left: 20px;
        margin-right: 20px;
    }
}

.e-table {
    background: #fff;
}
// ::v-deep.el-table__body-wrapper::-webkit-scrollbar{
//      width: 6px !important; // 横向滚动条
//     height: 10px !important// 纵向滚动条
// }

::v-deep .el-table__body-wrapper::-webkit-scrollbar {
    width: 6px; // 横向滚动条
    height: 10px; // 纵向滚动条
}
// 滚动条的滑块
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 5px;
}

.el-tab-pane {
    margin-left: -10px;
}
::v-deep.el-upload-dragger {
    height: 90px;
    margin-left: 300px;
}
.img-style {
    width: 25px;
    height: 25px;
    margin: 0px 0px 4px 5px;
}
// 境外单位
::v-deep .clearPadding .vxe-cell {
    padding: 0;
}
::v-deep .clearPaddingLeft .vxe-cell {
    padding-left: 0px;
}
::v-deep {
    .main-el-switch {
        position: relative;
        .el-switch__core {
            height: 24px;
            border-radius: 12px;
            &:after {
                left: 4px;
                top: 3px;
            }
        }
        &.el-switch {
            &.is-checked {
                .el-switch__core {
                    &:after {
                        margin-left: -20px;
                        left: 100%;
                    }
                }
            }
        }
        &.is-checked {
            .el-switch__label--left {
                opacity: 0;
            }
            .el-switch__label--right {
                opacity: 1;
            }
        }
        .el-switch__label {
            position: absolute;
            top: 0;
        }
        .el-switch__label--left {
            right: 0;
            color: #999;
            z-index: 1;
            margin-right: 8px;
        }
        .el-switch__label--right {
            left: 0;
            color: #fff;
            opacity: 0;
            margin-left: 8px;
        }
    }
}
</style>
